import React, {
    PureComponent
} from 'react';

import {
    View,
    Text,
    StyleSheet
} from 'react-native';

import * as CONST from './../../const';

interface State {
    text?: string,
    show?: boolean
}

class Warm extends PureComponent<any,State> {

    state = {
        text:``,
        show:false
    }

    show = (message:string) => {
        this.setState({
            text:message,
            show:true
        })
    }

    close = () => {
        this.setState({
            text:``,
            show:false
        })
    }

    render() {
        const {
            show,
            text
        } = this.state;
        return show ? (
            <View style={styles.container}>
                <Text style={styles.text}>
                    Error: {text}
                </Text>
            </View>
        ) : null;
    }
}

export default Warm;

const styles = StyleSheet.create({
    container: {
        borderWidth: 1,
        borderRadius: 4,
        marginBottom: 30,
        paddingVertical: 14,
        paddingHorizontal: 25,
        borderColor: CONST.color,
        backgroundColor: `rgba(255,0,174,.2)`
    },
    text: {
        fontSize: 12,
        color: `#fff`,
        lineHeight: 20
    }
}) as any;